package com.mq.service.impl;

import com.mq.Mapper.UserMapper;
import com.mq.pojo.User;
import com.mq.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import static com.mq.utils.HashUtils.getMd5String;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;
    @Override
    public User getUserByUserEmail(String email) {
        return userMapper.getUserByUserEmail(email);
    }

    @Override
    public void register(String email, String username, String password, String phone) {
        String encryptedPassword = getMd5String(password);
        System.out.print("加密的数据是"+password+"加密后："+encryptedPassword);
        userMapper.register(email,username,encryptedPassword,phone);


    }


}
